<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>参赛师生主页</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script type="text/javascript" src="assets/js/jquery-1.10.2.js"></script>
        <script src="./assets/js/jspdf.debug.js"></script>
        <script src="./assets/js/html2canvas.js"></script>

        <style>
            body {
                font-family: 'Sans', sans-serif;
                background-size:cover;
            }
            table{
                width: 600px;
                text-align: center;
            }
            .entry-receipt-PDF{
                text-align: center;
                background-color: #fff;
                color:#000;                
                padding: 20px;
                padding-top:5px;
                position: relative;                
                width:600px;/*595.28,841.89*/
                height:840px;
                left:50%;
                margin-left:-300px;
                margin-top:50px;
                border:1px solid #000;

            }
            .entry-receipt-table-PDF{
                width: 580px;
                heoght: 820px
                    /*display: flex;
                    align-items: center;*/
            }
            .button-center {
                margin-top: 10px;
                text-align:center;
            }
            .btn {
                width: 220px;
                height: 40px;
                font-size: 20px;
            }
            .table-container{
                position: relative; 
                display: flex;
                width:1500px;
                left:50%;
                margin-left:-750px;
                margin-top:50px;
            }
            .school-match{
                text-align: center;
                background-color: #fff;
                color:#000;                
                padding: 10px;
                padding-top:5px;
                position: relative;                
                width:1000px;
                left:50%;
                margin-left:-300px;
                margin-top:50px;
            }
            .school-question{
                margin-top: 20px;
                text-align: center;
                background-color: #fff;
                color:#000;                
                position: relative;                
                width:1800px;
                left:50%;
                margin-left:-900px;  
            }
            .table-layer1{
                height:300px;          
            }
            .table-left{

            }
            .table-right{
                margin-left:300px;

            }
            .top{
                /* 设置宽度高度背景颜色 */
                height: 40px; /*高度改为自动高度*/
                width:100%;
                margin-left: 0;
                background:rgb(189, 181, 181);
                position: relative; /*固定在顶部*/
                top: 0;/*离顶部的距离为0*/
                margin-bottom: 5px;
            }
            .top ul{
                /* 清除ul标签的默认样式 */
                width: auto;/*宽度也改为自动*/
                list-style-type: none;
                white-space:nowrap;
                overflow: hidden;
                margin-left: 5%;
                /* margin-top: 0;          */
                padding: 0;

            }
            .top li {
                float:left; /* 使li内容横向浮动，即横向排列  */
                margin-right:2%;  /* 两个li之间的距离*/
                position: relative;
                overflow: hidden;
            }

            .top li a{
                /* 设置链接内容显示的格式*/
                display: block; /* 把链接显示为块元素可使整个链接区域可点击 */
                color:white;
                text-align: center;
                padding: 3px;
                overflow: hidden;
                text-decoration: none; /* 去除下划线 */

            }
            .top li a:hover{
                /* 鼠标选中时背景变为黑色 */
                background-color: #111;
            }
            .top ul li ul{
                /* 设置二级菜单 */
                margin-left: -0.2px;
                background:rgb(189, 181, 181);
                position: relative;
                display: none; /* 默认隐藏二级菜单的内容 */

            }
            .top ul li ul li{
                /* 二级菜单li内容的显示 */

                float:none;
                text-align: center;
            }
            .top ul li:hover ul{
                /* 鼠标选中二级菜单内容时 */
                display: block;
            }
        </style>


    </head>
    <body>
        <div class="top">
            <center> 
                <ul>
                    <li><a href="#" onclick="window_leader(0)">个人和学校注册信息</a></li>
                    <li>
                        <a href="#">比赛成绩</a>
                        <ul>
                            <li><a href="#" onclick="window_leader(1)">您所在学校的比赛情况</a></li>
                            <li><a href="#" onclick="window_leader(2)">所有学校的总成绩</a></li>
                        </ul>
                    </li> 
                    <li><a href="#" onclick="window_leader(3)">参赛回执</a></li>
                </ul>
            </center>      
        </div>

        <?PHP
        if (!empty($_GET['email'])) {$email = $_GET['email'];} else {$email = '';}
        $mysqli = mysqli_init();
        $mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2); //设置超时时间
        $mysqli->real_connect('127.0.0.1', 'root', 'mysql');
        $sql = "CREATE DATABASE IF NOT EXISTS CUPT DEFAULT CHARSET utf8 COLLATE utf8_general_ci;";
        if ($mysqli->query($sql) == TRUE) {
        //printf("Table CUPT successfully created.\n");
        }
        mysqli_select_db($mysqli, "CUPT");
        $sql="select * from participant where `email`='$email'";
        $rst = $mysqli->query($sql);
        while ($row = mysqli_fetch_assoc($rst)) {
        $string='';
        $string=$string."<tr><th>Email</th><td>$email</td></tr>";
        $name = $row['name'];
        $string=$string."<tr><th>姓名</th><td>$name</td></tr>";
        $sex = $row['sex'];
        $string=$string."<tr><th>性别</th><td>$sex</td></tr>";
        $school = $row['school'];
        $string=$string."<tr><th>学校</th><td>$school</td></tr>";
        $job_title = $row['job_title'];
        $string=$string."<tr><th>职称或年级专业</th><td>$job_title</td></tr>";
        $team_position = $row['team_position'];
        $string=$string."<tr><th>队内职务</th><td>$team_position</td></tr>";
        $school_position = $row['school_position'];
        $string=$string."<tr><th>校内职务</th><td>$school_position</td></tr>";
        $phone_number = $row['phone_number'];
        $string=$string."<tr><th>手机号码</th><td>$phone_number</td></tr>";
        $clothing_model = $row['clothing_model'];
        $string=$string."<tr><th>衣服尺码</th><td>$clothing_model</td></tr>";
        $bank_account=$row['bank_account'];
        $string=$string."<tr><th>银行卡号</th><td>$bank_account</td></tr>";
        $bank=$row['bank'];
        $string=$string."<tr><th>开户银行</th><td>$bank</td></tr>";
        }

        $sql="select * from school_information_list where school='$school' limit 1;";
        $rst = $mysqli->query($sql);
        while ($row = mysqli_fetch_assoc($rst)) {
        $string2='';
        $email_contact = $row['email'];
        $string2=$string2."<tr><th>Email</th><td>$email_contact</td></tr>";
        $name = $row['name'];
        $string2=$string2."<tr><th>姓名</th><td>$name</td></tr>";
        $school = $row['school'];
        $string2=$string2."<tr><th>学校</th><td>$school</td></tr>";
        $taxpayer_identification_number = $row['taxpayer_identification_number'];
        $string2=$string2."<tr><th>纳税人识别号</th><td>$taxpayer_identification_number</td></tr>";
        $invoice_title = $row['invoice_title'];
        $string2=$string2."<tr><th>发票抬头</th><td>$invoice_title</td></tr>";
        $single_rooms = $row['single_rooms'];
        $string2=$string2."<tr><th>单间数量</th><td>$single_rooms</td></tr>";
        $standard_rooms = $row['standard_rooms'];
        $string2=$string2."<tr><th>标准间数量</th><td>$standard_rooms</td></tr>";
        $meeting_datetime = $row['meeting_datetime'] ;
        $string2=$string2."<tr><th>到达时间</th><td>$meeting_datetime</td></tr>";
        $leave_datetime = $row['leave_datetime'] ;
        $string2=$string2."<tr><th>离会时间</th><td>$leave_datetime</td></tr>";
        $halal_foods = $row['halal_foods'];
        $string2=$string2."<tr><th>需清真食品份数</th><td>$halal_foods</td></tr>";
        $school_number = $row['school_number'];
        $string2=$string2."<tr><th>学校抽签号</th><td>$school_number</td></tr>";
        }


        ?>
        <div id="sign_up_information" class="table-container" >
            <div class="table-left">
                <table class="table-layer1" width="400" border="1"  cellspacing="0">
                    <tr>
                        <th colspan="2">个人注册信息</th>
                    </tr>
                    <?PHP echo $string; ?>
                </table>
                <div class="button-center">
                    <a href="participant-signup.html?email=<?PHP echo $email;?>"><button class="btn">修改个人注册信息</button></a>
                </div>
            </div>

            <div class="table-right">
                <table class="table-layer1" width="400" border="1"  cellspacing="0">
                    <tr>
                        <th colspan="2">学校注册信息</th>
                    </tr>
                    <?PHP echo $string2; ?>
                </table>
                <div class="button-center">
                    <a href="school-signup.html?email=<?PHP echo $email_contact;?>"><button class="btn">修改学校注册信息</button></a>
                </div>
            </div>
        </div>


        <?PHP
        $sql="select * from participant_score_list where school='$school';";
        $rst = $mysqli->query($sql);
        $string3_1_1='';
        while ($row = mysqli_fetch_assoc($rst)) {


        $rounds= $row['rounds'];
        $string3_1_1=$string3_1_1."<td>$rounds</td>";
        $session= $row['session'];
        $string3_1_1=$string3_1_1."<td>$session</td>";
        $school_participant= $row['school'];
        $string3_1_1=$string3_1_1."<td>$school_participant</td>";
        $name= $row['name'];
        $string3_1_1=$string3_1_1."<td>$name</td>";
        $question= $row['question'];
        $string3_1_1=$string3_1_1."<td>$question</td>";
        $participant_score= $row['participant_score'];
        $string3_1_1=$string3_1_1."<td>$participant_score</td>";

        $identity= $row['identity'];
        switch ($identity){
        case 1:$identity='正方';break;
        case 2:$identity='反方';break;
        case 3:$identity='评论方';break;
        }
        $string3_1_1=$string3_1_1."<td>$identity</td>";
        $string3_1_1="<tr>".$string3_1_1."</tr>";
        }

        $sql="select * from school_question_list where school='$school';";
        $rst = $mysqli->query($sql);
        $string3_1_2='';
        while ($row = mysqli_fetch_assoc($rst)) {

        $school_participant= $row['school'];
        $string3_1_2=$string3_1_2."<td>$school_participant</td>";
        $question=array('','','','','','','','','','','','','','','','','','');
        $question_state_word=array('','','','','','','','','','','','','','','','','','');
        for($i=1;$i<=17;$i++){
        $question[$i]= $row["question_$i"];


        if(strstr($question[$i],'3')){$question_state_word[$i]=$question_state_word[$i].'作为正方拒绝过<br/>';}
        if(strstr($question[$i],'4')){$question_state_word[$i]=$question_state_word[$i].'作为正方比赛过<br/>';}
        if(strstr($question[$i],'5')){$question_state_word[$i]=$question_state_word[$i].'作为反方比赛过<br/>';}
        $question_state_word[$i]=rtrim($question_state_word[$i], "<br/>");
        $string3_1_2=$string3_1_2."<td>$question_state_word[$i]</td>";
        }
        $string3_1_2="<tr>".$string3_1_2."</tr>";
        }


        $sql="select *,sum(participant_score) as school_score from participant_score_list group by school order by school_score DESC;";
        $rst = $mysqli->query($sql);
        $string3_2_1='';
        $rank=0;
        while ($row = mysqli_fetch_assoc($rst)) {
        $rank= $rank+1;
        $string3_2_1=$string3_2_1."<td>$rank</td>";
        $school_participant= $row['school'];
        $string3_2_1=$string3_2_1."<td>$school_participant</td>";
        $school_score= $row['school_score'];
        $string3_2_1=$string3_2_1."<td>$school_score</td>";
        $string3_2_1="<tr>".$string3_2_1."</tr>";
        }
        
        $sql="select * from school_question_list;";
        $rst = $mysqli->query($sql);
        $string3_2_2='';
        while ($row = mysqli_fetch_assoc($rst)) {

        $school_participant= $row['school'];
        $string3_2_2=$string3_2_2."<td>$school_participant</td>";
        $question=array('','','','','','','','','','','','','','','','','','');
        $question_state_word=array('','','','','','','','','','','','','','','','','','');
        for($i=1;$i<=17;$i++){
        $question[$i]= $row["question_$i"];


        if(strstr($question[$i],'3')){$question_state_word[$i]=$question_state_word[$i].'作为正方拒绝过<br/>';}
        if(strstr($question[$i],'4')){$question_state_word[$i]=$question_state_word[$i].'作为正方比赛过<br/>';}
        if(strstr($question[$i],'5')){$question_state_word[$i]=$question_state_word[$i].'作为反方比赛过<br/>';}
        $question_state_word[$i]=rtrim($question_state_word[$i], "<br/>");
        $string3_2_2=$string3_2_2."<td>$question_state_word[$i]</td>";
        }
        $string3_2_2="<tr>".$string3_2_2."</tr>";
        }
        ?>


        <div id="match_score" >
            <div class="school-match">
                <table width="400" border="1"  cellspacing="0">
                    <tr>
                        <th colspan="8">学校比赛成绩</th>
                    </tr>
                    <tr>
                        <th>轮次</th><th>场次</th><th>参赛学校</th><th>选手姓名</th><th>题目编号</th><th>本场得分</th><th>本场身份</th>
                    </tr> 
                    <?PHP echo $string3_1_1; ?>
                </table>
            </div>
            <div class="school-question">
                <table width="400" border="1"  cellspacing="0" style="width:1800px;">
                    <tr>
                        <th colspan="18">学校选题情况</th>
                    </tr>
                    <tr>
                        <th>学校</th><th>题目1</th><th>题目2</th><th>题目3</th><th>题目4</th><th>题目5</th><th>题目6</th><th>题目7</th><th>题目8</th><th>题目9</th><th>题目10</th><th>题目11</th><th>题目12</th><th>题目13</th><th>题目14</th><th>题目15</th><th>题目16</th><th>题目17</th>
                    </tr> 
                    <?PHP echo $string3_1_2; ?>
                </table>
            </div>
        </div>

        <div id="all_school_match_score">
            <div class="school-match">
                <table width="400" border="1"  cellspacing="0">
                    <tr>
                        <th colspan="3">学校比赛成绩</th>
                    </tr>
                    <tr>
                        <th>排名</th><th>学校</th><th>总成绩</th>
                    </tr> 
                    <?PHP echo $string3_2_1; ?>
                </table>
            </div>
            <div class="school-question">
                <table width="400" border="1"  cellspacing="0" style="width:1800px;">
                    <tr>
                        <th colspan="18">学校选题情况</th>
                    </tr>
                    <tr>
                        <th>学校</th><th>题目1</th><th>题目2</th><th>题目3</th><th>题目4</th><th>题目5</th><th>题目6</th><th>题目7</th><th>题目8</th><th>题目9</th><th>题目10</th><th>题目11</th><th>题目12</th><th>题目13</th><th>题目14</th><th>题目15</th><th>题目16</th><th>题目17</th>
                    </tr> 
                    <?PHP echo $string3_2_2; ?>
                </table>
            </div>

        </div>

        <?PHP
        $string4="<tr><th>学校名称</th><td colspan='5'>$school</td></tr>";
        $string4=$string4."<tr><th>类别</th><th>姓名</th><th>性别</th><th>职称</th><th>手机</th><th>邮箱</th></tr>";

        $sql="select * from participant inner join school_information_list on participant.email=school_information_list.email;";
        $rst = $mysqli->query($sql);
        if($rst->num_rows!=0){
        $sub_string4="<tr><th rowspan='$rst->num_rows'>联系人</th>";
        while ($row = mysqli_fetch_assoc($rst)) {
        $name=$row['name'];
        $sex=$row['sex'];
        $job_title=$row['job_title'];
        $phone_number=$row['phone_number'];
        $email=$row['email'];
        $sub_string4=$sub_string4."<td>$name</td>";
        $sub_string4=$sub_string4."<td>$sex</td>";
        $sub_string4=$sub_string4."<td>$job_title</td>";
        $sub_string4=$sub_string4."<td>$phone_number</td>";
        $sub_string4=$sub_string4."<td>$email</td>";
        $sub_string4=$sub_string4."</tr><tr>";
        }
        $sub_string4=substr($sub_string4, 0, -4);//去掉末尾的<tr>
        $string4=$string4.$sub_string4;
        }

        $sql="select * from participant where `school`='$school' and `team_position`='领队';";
        $rst = $mysqli->query($sql);
        if($rst->num_rows!=0){
        $sub_string4="<tr><th rowspan='$rst->num_rows'>领队</th>";
        while ($row = mysqli_fetch_assoc($rst)) {
        $name=$row['name'];
        $sex=$row['sex'];
        $job_title=$row['job_title'];
        $phone_number=$row['phone_number'];
        $email=$row['email'];
        $sub_string4=$sub_string4."<td>$name</td>";
        $sub_string4=$sub_string4."<td>$sex</td>";
        $sub_string4=$sub_string4."<td>$job_title</td>";
        $sub_string4=$sub_string4."<td>$phone_number</td>";
        $sub_string4=$sub_string4."<td>$email</td>";
        $sub_string4=$sub_string4."</tr><tr>";
        }
        $sub_string4=substr($sub_string4, 0, -4);//去掉末尾的<tr>
        $string4=$string4.$sub_string4;
        }

        $sql="select * from judge where `school`='$school';";
        $rst = $mysqli->query($sql);
        if($rst->num_rows!=0){
        $sub_string4="<tr><th rowspan='$rst->num_rows'>评委</th>";
        while ($row = mysqli_fetch_assoc($rst)) {
        $name=$row['name'];
        $sex=$row['sex'];
        $job_title=$row['job_title'];
        $phone_number=$row['phone_number'];
        $email=$row['email'];
        $sub_string4=$sub_string4."<td>$name</td>";
        $sub_string4=$sub_string4."<td>$sex</td>";
        $sub_string4=$sub_string4."<td>$job_title</td>";
        $sub_string4=$sub_string4."<td>$phone_number</td>";
        $sub_string4=$sub_string4."<td>$email</td>";
        $sub_string4=$sub_string4."</tr><tr>";
        }
        $sub_string4=substr($sub_string4, 0, -4);//去掉末尾的<tr>
        $string4=$string4.$sub_string4;
        }

        $sql="select * from participant where `school`='$school' and `school_position`='学生' and (`team_position`='参赛队员' or `team_position`='参赛队长') ;";
        $rst = $mysqli->query($sql);
        if($rst->num_rows!=0){
        $sub_string4="<tr><th rowspan='$rst->num_rows'>参赛学生</th>";
        while ($row = mysqli_fetch_assoc($rst)) {
        $name=$row['name'];
        $sex=$row['sex'];
        $job_title=$row['job_title'];
        $phone_number=$row['phone_number'];
        $email=$row['email'];
        $sub_string4=$sub_string4."<td>$name</td>";
        $sub_string4=$sub_string4."<td>$sex</td>";
        $sub_string4=$sub_string4."<td>$job_title</td>";
        $sub_string4=$sub_string4."<td>$phone_number</td>";
        $sub_string4=$sub_string4."<td>$email</td>";
        $sub_string4=$sub_string4."</tr><tr>";
        }
        $sub_string4=substr($sub_string4, 0, -4);//去掉末尾的<tr>
        $string4=$string4.$sub_string4;
        }

        $sql="select * from participant where `school`='$school' and `school_position`='教师' and (`team_position`='观摩师生') ;";
        $rst = $mysqli->query($sql);
        if($rst->num_rows!=0){
        $sub_string4="<tr><th rowspan='$rst->num_rows'>观摩教师</th>";
        while ($row = mysqli_fetch_assoc($rst)) {
        $name=$row['name'];
        $sex=$row['sex'];
        $job_title=$row['job_title'];
        $phone_number=$row['phone_number'];
        $email=$row['email'];
        $sub_string4=$sub_string4."<td>$name</td>";
        $sub_string4=$sub_string4."<td>$sex</td>";
        $sub_string4=$sub_string4."<td>$job_title</td>";
        $sub_string4=$sub_string4."<td>$phone_number</td>";
        $sub_string4=$sub_string4."<td>$email</td>";
        $sub_string4=$sub_string4."</tr><tr>";
        }
        $sub_string4=substr($sub_string4, 0, -4);//去掉末尾的<tr>
        $string4=$string4.$sub_string4;
        }

        $sql="select * from participant where `school`='$school' and `school_position`='学生' and (`team_position`='观摩师生') ;";
        $rst = $mysqli->query($sql);
        if($rst->num_rows!=0){
        $sub_string4="<tr><th rowspan='$rst->num_rows'>观摩学生</th>";
        while ($row = mysqli_fetch_assoc($rst)) {
        $name=$row['name'];
        $sex=$row['sex'];
        $job_title=$row['job_title'];
        $phone_number=$row['phone_number'];
        $email=$row['email'];
        $sub_string4=$sub_string4."<td>$name</td>";
        $sub_string4=$sub_string4."<td>$sex</td>";
        $sub_string4=$sub_string4."<td>$job_title</td>";
        $sub_string4=$sub_string4."<td>$phone_number</td>";
        $sub_string4=$sub_string4."<td>$email</td>";
        $sub_string4=$sub_string4."</tr><tr>";
        }
        $sub_string4=substr($sub_string4, 0, -4);//去掉末尾的<tr>
        $string4=$string4.$sub_string4;
        }

        $sql="select * from participant where `school`='$school' and committee='是';";
        $rst = $mysqli->query($sql);
        if($rst->num_rows!=0){
        $sub_string4="<tr><th rowspan='$rst->num_rows'>竞赛委员会委员（请出现在竞委会名单中的高校填写）</th>";
        while ($row = mysqli_fetch_assoc($rst)) {
        $name=$row['name'];
        $sex=$row['sex'];
        $job_title=$row['job_title'];
        $phone_number=$row['phone_number'];
        $email=$row['email'];
        $sub_string4=$sub_string4."<td>$name</td>";
        $sub_string4=$sub_string4."<td>$sex</td>";
        $sub_string4=$sub_string4."<td>$job_title</td>";
        $sub_string4=$sub_string4."<td>$phone_number</td>";
        $sub_string4=$sub_string4."<td>$email</td>";
        $sub_string4=$sub_string4."</tr><tr>";
        }
        $sub_string4=substr($sub_string4, 0, -4);//去掉末尾的<tr>
        $string4=$string4.$sub_string4;
        }

        $sql="select a.cnt1+b.cnt2 from   (select count(*) cnt1 from participant where `school`='$school') a,   (select count(*) cnt2 from judge where `school`='$school') b;";
        $rst = $mysqli->query($sql);
        while ($row = mysqli_fetch_assoc($rst)) {
        $total_people_number=$row['a.cnt1+b.cnt2'];
        }
        $string4=$string4."<tr><th>总人数</th><td colspan='5'>".$total_people_number."</td></tr>";
        $sql="select invoice_title,taxpayer_identification_number from school_information_list where school='$school'";
        $rst = $mysqli->query($sql);
        while ($row = mysqli_fetch_assoc($rst)) {
        $invoice_title=$row['invoice_title'];
        $string4=$string4."<tr><th>发票抬头</th><td colspan='5'>".$invoice_title."</td></tr>";
        $taxpayer_identification_number=$row['taxpayer_identification_number'];
        $string4=$string4."<tr><th>纳税人识别号</th><td colspan='5'>".$taxpayer_identification_number."</td></tr>";
        }
        ?>
        <div id="receipt">
            <div id="renderPdf" class="entry-receipt-PDF">
                <h3>2019年CUPT中南赛区回执</h3>
                <div>
                    <table class width="580px" height="665px" border="1" cellspacing="0">    
                        <?PHP
                        echo $string4;
                        ?>
                    </table>
                </div>
                <div style="text-align:left;margin-left: 50%;">
                    <span style="">学校院系名称（盖章）：<br/><br/><br/>
                        领队签字：</span><br/>
                </div>

                <div style="text-align:right;margin-top:16px;"><span id="date" style=""></span></div>
            </div>    

            <div class="button-center">
                <button id="exportToPdf_butten" class="btn" onclick="exportToPdf()">将信息回执保存为PDF</button>
            </div> 
        </div>

        <script type="text/javascript">
            window.onload = function () {
                var d = new Date();
                var date = d.getFullYear() + "年" + (d.getMonth() + 1) + "月" + d.getDate() + "日";
                document.getElementById("date").innerText = date;
                window_leader(0);
            }
            window_leader_id_list = ['sign_up_information', 'match_score', 'all_school_match_score', 'receipt'];
            function window_leader(index) {
                for (i = 0; i < window_leader_id_list.length; i++) {
                    if (i == index) {
                        document.getElementById(window_leader_id_list[i]).style.visibility = "visible";//显示
                        document.getElementById(window_leader_id_list[i]).style.display = "";//显
                    } else {
                        document.getElementById(window_leader_id_list[i]).style.visibility = "hidden";//隐藏
                        document.getElementById(window_leader_id_list[i]).style.display = "none";//隐藏
                    }
                }
            }

            $(function () {
                $("#div").click(function () {
                    $(this).toggleClass("blue");
                });
            });

            function exportToPdf() {//导出pdf
                document.getElementById("renderPdf").style.border="0px";
                html2canvas(
                        document.getElementById("renderPdf"),
                        {
                            dpi: 172, //导出pdf清晰度
                            onrendered: function (canvas) {
                                var contentWidth = canvas.width;
                                var contentHeight = canvas.height;
                                //一页pdf显示html页面生成的canvas高度;
                                var pageHeight = contentWidth / 592.28 * 841.89;
                                //未生成pdf的html页面高度
                                var leftHeight = contentHeight;
                                //pdf页面偏移
                                var position = 0;
                                //html页面生成的canvas在pdf中图片的宽高（a4纸的尺寸[595.28,841.89]）
                                var imgWidth = 595.28;
                                var imgHeight = 592.28 / contentWidth * contentHeight;

                                var pageData = canvas.toDataURL('image/jpeg', 1.0);
                                var pdf = new jsPDF('', 'pt', 'a4');

                                //有两个高度需要区分，一个是html页面的实际高度，和生成pdf的页面高度(841.89)
                                //当内容未超过pdf一页显示的范围，无需分页
                                if (leftHeight < pageHeight) {
                                    pdf.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight);
                                } else {
                                    while (leftHeight > 0) {
                                        pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
                                        leftHeight -= pageHeight;
                                        position -= 841.89;
                                        //避免添加空白页
                                        if (leftHeight > 0) {
                                            pdf.addPage();
                                        }
                                    }
                                }
                                pdf.save('中南地区赛参赛回执.pdf');
                            },
                            //背景设为白色（默认为黑色）
                            background: "#fff"
                        })
                        document.getElementById("renderPdf").style.border="1px solid #000";
            }
           </script>



    </body>
</html>
